#include <iostream>
#include <cstdio>
#include <cstdlib>
#define LEN 81
int main(){
	char file[LEN];
	FILE *fp;
	char ch;
	long count,last;
	puts("Enter the name of the file to be processed:");
	scanf("%80s",file);
	if((fp=fopen(file,"rb"))==NULL){
		printf("reverse cant't open %s\n",file);
		exit(EXIT_FAILURE);
	}

	//定位到文件的尾部
	fseek(fp,0L,SEEK_END);
	last = ftell(fp);//当前的位置为尾部
	for(count = 1L;count <=last;count++){
		fseek(fp,-count,SEEK_END);
		ch = getc(fp);
		if(ch!=EOF && ch!='\n')
			putchar(ch);
	}

	putchar('\n');

	fclose(fp);
	return 0;

}



